<template>
	<view class="width_drawal">
		<view>
			<view class="w_money">
				<view class="title">收款人姓名</view>
				<view class="money">
					<input type="text" v-model="collection_name" placeholder="请输入收款人姓名">
				</view>
				<view class="title">支付宝账号</view>
				<view class="money">
					<input type="text" v-model="zfb" placeholder="应输入支付宝账号">
				</view>
				<view class="title">提现金额</view>
				<view class="money">
					<text>￥</text>
					<input type="digit" v-model="money" placeholder="0.00">
				</view>
				<view class="text">
					<view class="t_left">可提现金额：<text>{{wait_withdrawal}}元</text></view>
					<view class="t_right" @click="allBtn">全部提现</view>
				</view>
			</view>
		</view>
		<!-- <view class="w_tip">提示：申请提现需店长审核打款</view> -->
		<!-- 底部 -->
		<BottomBtn title='提交' @submit='submitBtn'></BottomBtn>
	</view>
</template>

<script>
	import BottomBtn from '@/components/bottom_btn/bottom_btn.vue';
	export default {
		components:{
			BottomBtn
		},
		data() {
			return {
				wait_withdrawal:'0.00',
				collection_name:'',
				zfb:'',
				money:'',
			};
		},
		onLoad(opt) {
			this.wait_withdrawal=opt.money
		},
		onShow() {
			this.shopInfo()
		},
		methods:{
			allBtn(){
				this.money=this.wait_withdrawal
			},
			// 获取用户信息
			shopInfo(){
				var that = this
				that.$tips.showLoading('加载中')
				that.$httpApi.userShop().then((res)=>{
					that.$tips.hideLoading()
					if(res.code==1){
						// that.money = res.data.userinfo.money;
						that.wait_withdrawal = res.data.userinfo.money;
					}
				})
			},
			submitBtn(){
				var that = this
				if(that.money=='' || that.money*1==0){
					that.$tips.showToast('请输入提现金额')
					return
				}else{
					that.$tips.showLoading('提交中')
					var params = {
						money:that.money,
						collection_name:that.collection_name,
						zfb:that.zfb
					}
					that.$httpApi.userWithdrawcash(params).then((res)=>{
						that.$tips.hideLoading()
						if(res.code==1){
							that.$tips.showToast('申请成功')
							setTimeout(function(){
								uni.navigateBack()
							},2000)
						}
					})
				}
			},
		}
	}
</script>

<style lang="less">
	/deep/ .uni-input-placeholder{font-size:32rpx}
	.width_drawal{
		width: 100%;
		padding: 24rpx 0;
		.w_tip{
			width: 100%;
			font-size: 24rpx;
			color: #666;
			padding-top: 20rpx;
		}
		.w_money{
			margin:20rpx;
			padding: 30rpx;
			background: #fff;
			border-radius: 20rpx;
			.header{}
			.title{
				width: 100%;
				font-size: 30rpx;
				color: #333;
			}
			.money{
				width: 100%;
				padding: 30rpx 0 20rpx;
				border-bottom: 1rpx solid #f1f1f1;
				display: flex;
				align-items: center;
				justify-content: space-between;
				text{
					font-size: 48rpx;
					color: #333;
				}
				input{
					display: block;
					width: 650rpx;
					height: 60rpx;
					line-height: 60rpx;
					font-size: 48rpx;
					color: #333;
				}
			}
			.text{
				width: 100%;
				padding: 30rpx 0 0;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.t_left{
					display: flex;
					align-items: center;
					justify-content: flex-start;
					font-size: 26rpx;
					color: #666;
					text{
						color: #FF2525;
					}
				}
				.t_right{
					display: flex;
					align-items: center;
					justify-content: flex-end;
					font-size: 26rpx;
					color: #FF2525;
				}
			}
		}
	}
</style>
